package com.quwan.manager.service.impl;

import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.quwan.common.result.PageResult;
import com.quwan.entity.AppVersion;
import com.quwan.manager.controller.dto.AppVersionDto;
import com.quwan.manager.service.IAppVersionService;
import com.quwan.mapper.AppVersionMapper;
import lombok.RequiredArgsConstructor;
import org.springframework.stereotype.Service;

/**
 * <p>
 * app更新表 服务实现类
 * </p>
 *
 * @author laozhang
 * @since 2022-01-13
 */
@Service
@RequiredArgsConstructor
public class AppVersionServiceImpl extends ServiceImpl<AppVersionMapper, AppVersion> implements IAppVersionService {

    private final AppVersionMapper appVersionMapper;
    @Override
    public PageResult<AppVersionDto> getAppVersionListPage(int page, int size, Integer systemType, String version, String beginTime, String endTime) {
        Page<AppVersionDto> appVersionPage = appVersionMapper.selectAppVersionDtoList(new Page<>(page, size),systemType,version,beginTime,endTime);
        PageResult<AppVersionDto> result = new PageResult<AppVersionDto>()
                .setCurrent(appVersionPage.getCurrent())
                .setPages(appVersionPage.getPages())
                .setSize(appVersionPage.getSize())
                .setTotal(appVersionPage.getTotal())
                .setRecords(appVersionPage.getRecords());
        return result;
    }
}
